import {useState,useEffect} from 'react'
export default ()=>{
    const [count,setCount]=useState(0)
    useEffect(()=>{
        let timer=setInterval(()=>{
            setCount(count=>count+1)
            console.log("--------------------------");
        },1000)
        return ()=>{
            clearInterval(timer)
        }   
    },[])
    return (<>
        <div>{count}</div>
    </>)
}